package com.jrzh.mvc.model.sys;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.jrzh.framework.annotation.UniqueValue;
import com.jrzh.framework.base.model.GeneralModel;
@Entity
@Table(name="sys_users")
public class UserModel extends GeneralModel{
	
	@Column(name="_code")
	@NotNull(message="sysUser.code.validate.not_null")
	@UniqueValue(message = "sysUser.code.validate.unique")
	private String code;
	
	@Column(name="_name")
	@NotNull(message="sysUser.name.validate.not_null")
	private String name;
	
	@Column(name="_password")
	@NotNull(message="sysUser.password.validate.not_null")
	private String password;
	
	@Column(name="_audit_password")
	private String auditPassword;
	
	@Column(name="_salt")
	@NotNull(message="sysUser.salt.validate.not_null")
	private String salt;
	
	
	@Column(name="_sex")
	@NotNull(message="sysUser.sex.validate.not_null")
	private Integer sex;
	
	@Column(name="_status")
	@NotNull(message="sysUser.status.validate.not_null")
	private Integer status;
	
	@Column(name="_card_id")
	private String cardId;
	
	@Column(name="_tel")
	private String tel;
	
	@Column(name="_address")
	@Size(min = 0, max = 500)
	private String address;
	
	@Column(name="_email")
	private String email;
	
	@Column(name="_remark")
	@Size(min = 0, max = 500)
	private String remark;
	
	@ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "sys_users_roles", joinColumns = { @JoinColumn(name = "_user_id") }, inverseJoinColumns = { @JoinColumn(name = "_role_id") })
	private List<RoleModel> roles;
	
	@Column(name="_url")
	private String  url;
	
	@Column(name="_type")
	private String  type;
	/**
	 * 关联微信用户Id
	 */
	@Column(name="_open_id")
	private String  openId;
	
	/**
	 * 到期时间
	 */
	@Column(name="_end_time")
	private String  endTime;
	
	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getAuditPassword() {
		return auditPassword;
	}

	public void setAuditPassword(String auditPassword) {
		this.auditPassword = auditPassword;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}


	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getCardId() {
		return cardId;
	}

	public void setCardId(String cardId) {
		this.cardId = cardId;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public List<RoleModel> getRoles() {
		return roles;
	}

	public void setRoles(List<RoleModel> roles) {
		this.roles = roles;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

}
